<?php

namespace app\common\utils;

use app\common\constant\ErrorCode;

/**
 * 自定义异常类
 */
class MyException extends \Exception
{
    public function __construct($code, $my_msg = '')
    {
        $message = (ErrorCode::$message[$code] ?? '未知错误');
        if (!empty($my_msg)) {
            $message .= ':' . $my_msg;
        }
        parent::__construct($message, $code);
    }
}